﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Zero.UControl.Component;

namespace Zero.UControl.Demo.Views.LoadingDemo
{
    /// <summary>
    /// LoadingDemo.xaml 的交互逻辑
    /// </summary>
    public partial class LoadingDemo : UserControl, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;

        public LoadingDemo()
        {
            InitializeComponent();
        }

        private LoadingState currentState = LoadingState.UnLoading;

        public LoadingState CurrentState
        {
            get { return currentState; }
            set 
            {
                currentState = value;
                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(nameof(CurrentState)));
            }
        }


        private void Button_Click(object sender, RoutedEventArgs e)
        {
            CurrentState = CurrentState == LoadingState.Loading ? LoadingState.UnLoading : LoadingState.Loading;
        }
    }
}
